home *** CD-ROM | disk | FTP | other *** search
- function strint(n: integer): StdStr;
- { Return a two digit string value for the input integer }
- var
- s: StdStr;
- begin { strint }
- str(n:2, s);
- strint := s
- end;
-
- function zeller(day, month, year: integer): integer;
- { Compute the day of the week using Zeller's Congruence }
- var
- century: integer;
- begin { zeller }
- if month > 2
- then month := month - 2
- else
- begin
- month := month + 10;
- year := year - 1
- end;
- century := year div 100;
- year := year mod 100;
- zeller := (day - 1 + ((13 * month - 1) div 5) + (5 * year div 4) +
- century div 4 - 2 * century + 1) mod 7;
- end;
-
- function formtime(t: tad_array): StdStr;
- var
- i: integer;
- line, ampm: StdStr;
- begin { formtime }
- { line := strint(t[2]) + ':' + strint(t[1]) + ':' + strint(t[0]); }
- if t[2] > 12
- then
- begin
- ampm := ' pm';
- t[2] := t[2] - 12
- end
- else ampm := ' am';
- if t[2] = 0
- then t[2] := 12;
- line := strint(t[2]) + ':' + strint(t[1]);
- for i:= 2 to length(line) do
- if line[i] = ' '
- then line[i]:= '0';
- formtime := line + ampm
- end;
-
- function formdate(t: tad_array): StdStr;
- const
- day: array [0..6] of string[6] =
- ('Sun','Mon','Tues','Wednes','Thurs','Fri','Satur');
- month: array [1..12] of string[3] =
- ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
- begin { formdate }
- { formdate := strint(t[0]) + ' ' + month[t[1]] + ' ' + strint(t[2]) }
- if t[1] > 0
- then formdate := day[zeller(t[0], t[1], t[2] + 1900)] + 'day, ' +
- strint(t[0]) + ' ' + month[t[1]] + ' 19' + strint(t[2])
- else formdate := ''
- end;